﻿//
// Created by 50177 on 2019/7/10.
//

#ifndef OCTGUI_REQUEST_H
#define OCTGUI_REQUEST_H

//#include "include/OCTDevice/OctMirror.h"
//#include <include/OCTDevice/OctMotor.h>
#include "include/commonconst.h"

#include <QMetaType>

class Request {
public:
    enum Type {
        Motor_Stop = 0,
        Motor_Move_Infinite = 1,
        Motor_Move_Relative = 2,
        Motor_Move_Absolute = 3,
        Motor_Query_Location = 4,
        Top_Board_Version_Query,
        Bottom_Board_Version_Query,
        DAC_Board_Version_Query,
        OLED_Position_Control,
        Eye_Light_Control,
        SLD_Control,
        Mirror_Reset,
        Mirror_Mode_Control,
        Mirror_Axis_Fast_Length_Control,
        Mirror_Axis_Slow_Length_Control
    };
public:
    //--added by qinyaning.20200713
    Request();
    //--
    //Request(IN Type type, IN_OUT OctMotor *motor);

    Request(IN Type type);

    void setAxisFastStart(IN double axisLength) {
        axisFastStart = axisLength;
    }

    double getAxisFastStart() const {
        return axisFastStart;
    }

    void setAxisSlowStart(IN double axisLength) {
        axisSlowStart = axisLength;
    }

    double getAxisSlowStart() const {
        return axisSlowStart;
    }

    void setAxisFastEnd(IN double axisLength) {
        this->axisFastEnd = axisLength;
    }

    double getAxisFastEnd() const {
        return axisFastEnd;
    }

    void setAxisSlowEnd(IN double axisLength) {
        this->axisSlowEnd = axisLength;
    }

    double getAxisSlowEnd() const {
        return axisSlowEnd;
    }

    void setLightOn(IN bool lightOn) {
        this->lightOn = lightOn;
    }

    bool getLightOn() const {
        return lightOn;
    }

    void setOLED_X(IN quint8 x) {
        oledX = x;
    }

    void setOLED_Y(IN quint8 y) {
        oledY = y;
    }

    qint8 getOLED_X() const {
        return oledX;
    }

    qint8 getOLED_Y() const {
        return oledY;
    }

    void setSldLevel(IN quint8 level) {
        sldLevel = level;
    }

    qint8 getSldLevel() const {
        return sldLevel;
    }

    bool isDone() const {
        return done;
    }

    Type getType() const {
        return type;
    }

    //OctMotor::Direction getDirection() const {
    //    return direction;
    //}

    //void setDirection(IN OctMotor::Direction direction) {
    //    this->direction = direction;
    //}

    //OctMotor *getMotor() const {
    //    return motor;
    //}

    double getTargetLocation() const {
        return targetLocation;
    }

    double getRelativeLocation() const {
        return relativeLocation;
    }

    void setTargetLocation(IN double targetLocation) {
        this->targetLocation = targetLocation;
    }

    void setRelativeLocation(IN double relativeLocation) {
        this->relativeLocation = relativeLocation;
    }

    void setEyeLightNumber(quint8 number) {
        eyeLightNumber = number;
    }

    quint8 getEyeLightNumber() const {
        return eyeLightNumber;
    }

    void setVoltage(IN double voltage) {
        voltage = voltage;
    }

    double getVoltage() const {
        return voltage;
    }

    void setCycle(IN double cycle) {
        this->cycle = cycle;
    }

    double getCycle() const {
        return cycle;
    }

	double getRpm() const {
		return rpm;
	}

	Request &getInstance ()
	{
		Request instance;

		return instance;
	}
    //OctMode::Mode getMode() const {
    //    return mode;
    //}

    //void setMode(IN OctMode::Mode mode) {
    //    this->mode = mode;
    //}

    //void setMirrorDirection(IN OctMode::ScanDirection direction) {
    //    mirrorDirection = direction;
    //}

    //void setMirrorTrigger(IN OctMode::SignalTrigger trigger) {
    //    mirrorTrigger = trigger;
    //}

    //OctMode::ScanDirection getMirrorDirection() const {
    //    return mirrorDirection;
    //}

    //OctMode::SignalTrigger getMirrorTrigger() const {
    //    return mirrorTrigger;
    //}

private:
    bool done = false;
    Type type;
    //OctMotor::Direction direction;
    //OctMotor *motor = nullptr;
    double targetLocation;
    double relativeLocation;
    bool lightOn = false;
    quint8 eyeLightNumber;
    quint8 sldLevel;
    quint8 oledX;
    quint8 oledY;
    double voltage;
    double cycle;
    double axisFastStart;
    double axisSlowStart;
    double axisFastEnd;
    double axisSlowEnd;
	double rpm;
    //OctMode::Mode mode;
    //OctMode::ScanDirection mirrorDirection;
    //OctMode::SignalTrigger mirrorTrigger;

};

Q_DECLARE_METATYPE(Request)
#endif //OCTGUI_REQUEST_H
